package controller

import (
	"context"
	"lot_admin_api/api"
	"lot_admin_api/internal/model"
	"lot_admin_api/internal/service"
)

var ThirdParty = cThirdParty{}

type cThirdParty struct{}

// AliYunShortMessage  阿里云发送短信
func (h *cThirdParty) AliYunShortMessage(ctx context.Context, req *api.AliyunShortMessageReq) (res *model.AliyunShortMessageRes, err error) {
	res, err = service.PhoneCode().GetPhoneCode(ctx, req)
	return res, err
}

// TenXunMapBicycling  计算两地间的骑行距离
func (h *cThirdParty) TenXunMapBicycling(ctx context.Context, req *api.TenXunMapBicyclingReq) (res *model.TenXunMapResultRes, err error) {
	res, err = service.TenXunMap().TenXunMapBicycling(ctx, req)
	return res, err
}

// AliYunUploadFile  阿里云上传文件
func (h *cThirdParty) AliYunUploadFile(ctx context.Context, req *api.AliyunUploadFileReq) (res *model.AliyunUploadFileRes, err error) {
	url, err := service.UploadFile().AliyunUploadFile(ctx, req)
	res = &model.AliyunUploadFileRes{
		Url: url,
	}
	return res, err
}
